import qs from 'qs';
import ajax from '@/utils/ajaxiView';

export default {
  login(data) {
    return ajax.post('/admin/Auth/login', qs.stringify({'admin_name': data.adminName, 'password': data.password}));
  },
  pager(search, pager) {
    return ajax.get('/admin/User/index?page='+pager.current+'&limit='+pager.limit+'&'+qs.stringify(search));
  },
  findFirstById(id) {
    return ajax.get('/admin/User/findFirstById/' +  id);
  },
  findFirstByUserCode(val) {
    return ajax.get('/admin/User/findFirstByUserCode/' +  val);
  },
  findTeamByUserCode(val) {
    return ajax.get('/admin/User/findTeamByUserCode/' +  val);
  },
  findTeamById(id) {
    return ajax.get('/admin/User/findTeamById/' +  id);
  },
  update(id, data) {
    return ajax.put('/admin/User/update/' +  id, qs.stringify(data));
  }
};
